<!doctype html>


<html>
<head>
  <link rel="shortcut icon" href="static/images/favicon.ico" type="image/x-icon">
  <title>currency (Closure Library API Documentation - JavaScript)</title>
  <link rel="stylesheet" href="static/css/base.css">
  <link rel="stylesheet" href="static/css/doc.css">
  <link rel="stylesheet" href="static/css/sidetree.css">
  <link rel="stylesheet" href="static/css/prettify.css">

  <script>
     var _staticFilePath = "static/";
     var _typeTreeName = "goog";
     var _fileTreeName = "Source";
  </script>

  <script src="static/js/doc.js">
  </script>


  <meta charset="utf8">
</head>

<body onload="grokdoc.onLoad();">

<div id="header">
  <div class="g-section g-tpl-50-50 g-split">
    <div class="g-unit g-first">
      <a id="logo" href="index.html">Closure Library API Documentation</a>
    </div>

    <div class="g-unit">
      <div class="g-c">
        <strong>Go to class or file:</strong>
        <input type="text" id="ac">
      </div>
    </div>
  </div>
</div>





<div class="colmask rightmenu">
<div class="colleft">
    <div class="col1">
      <!-- Column 1 start -->

<div id="title">
       <span class="fn">i18n.currency</span>
</div>

<hr/>


  <h2>Classes</h2>
   
<br/>

  <div class="legend">
        <span class="key publickey"></span><span>Public</span>
        <span class="key protectedkey"></span><span>Protected</span>
        <span class="key privatekey"></span><span>Private</span>
  </div>









<div class="section">
  <table class="horiz-rule">


  </table>
</div>




  <h2>Global Functions</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.addTier2Support"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">addTier2Support<span class="args">()</span>
        </span>
      </div>


     <div class="entryOverview">
       This function will add tier2 currency support. Be default, only tier1
(most popular currencies) are supported. If an application really needs
to support some of the rarely used currencies, it should call this function
before any other functions in this namespace.

     </div>

   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line74">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.adjustPrecision"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">adjustPrecision<span class="args">(<span class="arg">pattern</span>,&nbsp;<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Modify currency pattern string by adjusting precision for given currency.
Standard currency pattern will have 2 digit after decimal point.
Examples:
  $#,##0.00 -&gt;  $#,##0    (precision == 0)
  $#,##0.00 -&gt;  $#,##0.0  (precision == 1)
  $#,##0.00 -&gt;  $#,##0.000  (precision == 3)


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">pattern</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">currency pattern string.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            modified currency pattern string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line237">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getCurrencyPattern_"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getCurrencyPattern_<span class="args">(<span class="arg">patternNum</span>,&nbsp;<span class="arg">sign</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       This function constructs the currency pattern. Currency sign is provided. The
pattern information is encoded in patternNum.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">patternNum</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Number">number</a></span>
        <div class="entryOverview">Encoded pattern number that has
    currency pattern information.</div>
     </td>
   </tr>
     
   <tr class="odd">
     <td>
        <span class="entryName">sign</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">The currency sign that will be used in pattern.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            currency pattern string.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line203">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getGlobalCurrencyPattern"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getGlobalCurrencyPattern<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Global currency pattern always uses ISO-4217 currency code as prefix. Local
currency sign is added if it is different from currency code. Each currency
is unique in this form. The negative side is that ISO code looks weird in
some countries as people normally do not use it. Local currency sign
alleviates the problem, but also makes it a little verbose.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Global currency pattern string for given currency.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line96">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getGlobalCurrencySign"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getGlobalCurrencySign<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Return global currency sign string for those applications
that want to handle currency sign themselves.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Global currency sign for given currency.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line114">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getLocalCurrencyPattern"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getLocalCurrencyPattern<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Local currency pattern is the most frequently used pattern in currency's
native region. It does not care about how it is distinguished from other
currencies.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Local currency pattern string for given currency.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line129">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getLocalCurrencySign"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getLocalCurrencySign<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Returns local currency sign string for those applications that need to
handle currency sign separately.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Local currency sign for given currency.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line142">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getPortableCurrencyPattern"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getPortableCurrencyPattern<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Portable currency pattern is a compromise between local and global. It is
not a mere blend or mid-way between the two. Currency sign is chosen so that
it looks familiar to native users. It also has enough information to
distinguish itself from other popular currencies in its native region.
In this pattern, currency sign symbols that has availability problem in
popular fonts are also avoided.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Portable currency pattern string for given currency.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line158">code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.getPortableCurrencySign"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">getPortableCurrencySign<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
      </div>


     <div class="entryOverview">
       Return portable currency sign string for those applications that need to
handle currency sign themselves.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>&nbsp;
            Portable currency sign for given currency.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line171">code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>






  <td>
    <a name="goog.i18n.currency.isPrefixSignPosition"></a>


     <div class="arg">
       <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">isPrefixSignPosition<span class="args">(<span class="arg">currencyCode</span>)</span>
        </span>
        &#8658; <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>
      </div>


     <div class="entryOverview">
       This function returns the default currency sign position. Some applications
may want to handle currency sign and currency amount separately. This
function can be used in such situations to correctly position the currency
sign relative to the amount.

To match the behavior of ICU, position is not determined by display locale.


     </div>


    <! -- Method details -->
    <div class="entryDetails">

      <div class="detailsSection">
        <b>Arguments: </b>






<table class="horiz-rule">
     
   <tr class="even">
     <td>
        <span class="entryName">currencyCode</span>
        : <span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/String">string</a></span>
        <div class="entryOverview">ISO-4217 3-letter currency code.</div>
     </td>
   </tr>
  </table>
      </div>
   
      <div class="detailsSection">
        <b>Returns:</b>&nbsp;<span class="type"><a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Boolean">boolean</a></span>&nbsp;
            true if currency should be positioned before amount field.
      </div>
  
    </div>
   
  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line187">code &raquo;</a>
  </td>
     </tr>


  </table>
</div>



  <h2>Global Properties</h2>





<div class="section">
  <table class="horiz-rule">


     <tr class="even entry public">
       <td class="access"></td>





  <a name="goog.i18n.currency.CurrencyInfo"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">CurrencyInfo</span>
        : 
     </div>


     <div class="entryOverview">
       Tier 1 currency information.

The first number in the array is a combination of the precision mask and
other flags. The precision mask indicates how many decimal places to show for
the currency. Valid values are [0..7]. The position flag indicates whether
the currency sign should be positioned after the number. Valid values are 0
(before the number) or 16 (after the number). The space flag indicates
whether a space should be inserted between the currency sign and number.
Valid values are 0 (no space) and 32 (space).

The number in the array is calculated by adding together the mask and flag
values. For example:

0: no precision (0), currency sign first (0), no space (0)
2: two decimals precision (2), currency sign first (0), no space (0)
18: two decimals precision (2), currency sign last (16), no space (0)
50: two decimals precision (2), currency sign last (16), space (32)


     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line272">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry public">
       <td class="access"></td>





  <a name="goog.i18n.currency.CurrencyInfoTier2"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">CurrencyInfoTier2</span>
        : 
     </div>


     <div class="entryOverview">
       Tier 2 currency information.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line339">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.i18n.currency.POSITION_FLAG_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">POSITION_FLAG_</span>
        : 
     </div>


     <div class="entryOverview">
       Whether the currency sign should be positioned after the number.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line51">Code &raquo;</a>
  </td>
     </tr>


     <tr class="odd entry private">
       <td class="access"></td>





  <a name="goog.i18n.currency.PRECISION_MASK_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">PRECISION_MASK_</span>
        : 
     </div>


     <div class="entryOverview">
       The mask of precision field.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line44">Code &raquo;</a>
  </td>
     </tr>


     <tr class="even entry private">
       <td class="access"></td>





  <a name="goog.i18n.currency.SPACE_FLAG_"></a>

  <td>


     <div class="arg">
        <img align="left" src="static/images/blank.gif">

        <span class="entryNamespace">goog.i18n.currency.</span><span class="entryName">SPACE_FLAG_</span>
        : 
     </div>


     <div class="entryOverview">
       Whether a space should be inserted between the number and currency sign.

     </div>

  </td>


  <td class="view-code">
     <a href="local_closure_goog_i18n_currency.js.source.html#line58">Code &raquo;</a>
  </td>
     </tr>


  </table>
</div>
      <!-- Column 1 end -->
    </div>

        <div class="col2">
          <!-- Column 2 start -->
          <div class="col2-c">
            <h2 id="ref-head">Package i18n</h2>
            <div id="localView"></div>
          </div>

          <div class="col2-c">
            <h2 id="ref-head">Package Reference</h2>
            <div id="sideTypeIndex" rootPath="" current="i18n.currency"></div>
          </div>
          <!-- Column 2 end -->
        </div>
</div>
</div>

</body>
</html>
